<script setup>
import { provide, ref } from 'vue';

import Child from "./子组件.vue"

const color = ref("red")
provide("color", color)
const changeColor = (_color) => {
    color.value = _color
}
</script>

<template>
    <h2>父组件</h2>
    <div>当前的颜色为{{ color }}</div>
    <button @click="changeColor('blue')">蓝色</button>
    <button @click="changeColor('yellow')">黄色</button>
    <button @click="changeColor('green')">绿色</button>
    <child></child>
</template>
